apiVersion: v1
items:
- apiVersion: v1
  kind: BuildConfig
  metadata:
    labels:
      build: the-new-hotness-build
    name: the-new-hotness-build
  spec:
    runPolicy: Serial
    source:
      dockerfile: |-
        FROM fedora:36
        LABEL \
          name="the-new-hotness" \
          vendor="Fedora Infrastructure" \
          license="GPLv2+"
        ENV HOME=/tmp
        RUN dnf install -y \
                git \
                fedpkg \
                rpmdevtools \
                fedora-messaging \
                python3-bugzilla \
                python3-koji \
                python3-requests \
                python3-pip && \
            dnf autoremove -y && \
            dnf clean all -y
        RUN git clone https://github.com/fedora-infra/the-new-hotness.git && \
                pushd the-new-hotness && \
{% if env == 'staging' %}
                git checkout staging && \
{% else %}
                git checkout production && \
{% endif %}
                pip-3 install . && \
                rm -rf the-new-hotness
        RUN rm -f /etc/krb5.conf && \
            ln -sf /etc/krb5/krb5.conf /etc/krb5.conf && \
            ln -sf /etc/keytabs/koji-keytab /etc/krb5.hotness_hotness{{ env_suffix }}.fedoraproject.org.keytab
        EXPOSE 9940
      type: Dockerfile
      git:
        uri: https://github.com/fedora-infra/the-new-hotness.git
{% if env == 'staging' %}
        ref: staging
{% else %}
        ref: production
{% endif %}
    strategy:
      type: Docker
      dockerStrategy:
        noCache: true
    output:
      to:
        kind: ImageStreamTag
        name: the-new-hotness:latest
    triggers:
{% if stg_anitya_github_secret is defined and env == 'staging' %}
    - type: GitHub
      github:
        secret: "{{ stg_hotness_github_secret }}"
{% elif anitya_github_secret is defined and env == 'production' %}
    - type: GitHub
      github:
        secret: "{{ hotness_github_secret }}"
{% endif %}
    - type: ImageChange
kind: List
metadata: {}
